#include "GlDesaturationEffect.h"

#include "GlGraphicComponent.h"
#include "Utility.h"

namespace GraphicLibrary
{
	//----------------------------------------------------
	DesaturationEffect::~DesaturationEffect()
	{
		GraphicComponent::msSaturation = 1.0f;
	}

	//----------------------------------------------------
	bool DesaturationEffect::tick(const float deltaTime)
	{
		mTime += deltaTime;
		float perc = Utility::clamp(0.0f, 1.0f, mTime / mDuration);
		float saturation = Utility::lerp(0.0f, 1.0f, perc);
		GraphicComponent::msSaturation = saturation;
		return perc == 1.0f;
	}
}
